Skip to content

Claude/duet3 async actors a0j gn#2

Merged
jvishnefske merged 6 commits into
mainfrom
claude/duet3-async-actors-A0jGn
Feb 19, 2026
Merged

Claude/duet3 async actors a0j gn#2
jvishnefske merged 6 commits into
mainfrom
claude/duet3-async-actors-A0jGn

Conversation

@jvishnefske

Copy link
Copy Markdown
Owner

No description provided.

Complete rewrite as an async actor-based embedded firmware targeting
the ATSAME54P20A (Cortex-M4F, 120MHz) on the Duet 3 Mini 5+ board.

Architecture — Embassy async actors with zero-allocation message passing:
- actor-framework: Typed mailboxes, event bus, select primitives
- board-hal: Duet 3 Mini 5+ pin mappings, TMC2209 UART protocol, thermistors, PWM
- gcode-parser: Zero-alloc no_std parser for RepRapFirmware G-codes (13 tests passing)
- motion-planner: Trapezoidal acceleration profiles, multi-axis Bresenham coordination
- thermal: PID temperature control with anti-windup, thermal runaway detection
- sdcard: FAT32 line reader for config.g and G-code job files
- firmware: Main binary wiring 6 concurrent async actor tasks

Supported G-codes: G0/G1/G28/G90/G91/G92, M92/M104/M106/M109/M112/M114/M140/
M190/M201/M203/M204/M206/M208/M350/M400/M500/M501/M503/M569/M584/M906

Control is always responsive — G-code dispatch never blocks on motor moves.
Motion commands are queued to the planner and step generator runs independently.

https://claude.ai/code/session_01HW3tB5wfRQxiio5qmPbFmt
Runs check, test (gcode-parser on host), rustfmt, and clippy
on push/PR to main.

https://claude.ai/code/session_01HW3tB5wfRQxiio5qmPbFmt
- Use core::f32::consts::SQRT_2 instead of magic number in TMC2209 current calc
- Remove no-op bit shift in CHOPCONF builder
- Add Default impls for MotionPlanner, ThermalManager, LineReader
- Use is_none_or instead of map_or in gcode parser
- Replace manual loops with iterators (copy_from_slice, enumerate)
- Collapse nested if statements in trapezoid generator
- Allow too_many_arguments on internal segment builder functions
- Fix unnecessary i32 cast in step generator
- Apply rustfmt across entire workspace
- Update CI to auto-commit cargo fmt changes on PRs via
  stefanzweifel/git-auto-commit-action, with check/test/clippy
  gated behind the fmt job

https://claude.ai/code/session_01HW3tB5wfRQxiio5qmPbFmt
Architecture changes:
- Create `printer-hal` crate with platform-agnostic traits (StepperDriver,
  TemperatureSensor, HeaterOutput, FileSystem, EndstopReader)
- Create `dispatcher` crate — portable G-code command routing (was in main.rs)
- Move step generator from main.rs into `motion-planner::step_generator`,
  parameterized by StepperDriver trait
- Decouple `thermal` from `board-hal` — now depends only on `printer-hal`
- Decouple `sdcard` from all Embassy/embedded deps — pure no_std line reader
- Slim `firmware/main.rs` from 804→492 lines — only channels + task wrappers
  + hardware HAL impls (Duet3Stepper stub)
- Create `wasm-sim` crate with mock HAL impls for browser/host testing
- Move DutyCycle, TempChannel, PwmChannel to `printer-hal` (shared types)
- `board-hal` re-exports from `printer-hal` for backward compat

Testing:
- 63 tests across 5 crates (gcode-parser, motion-planner, thermal,
  sdcard, dispatcher), all run on host x86_64
- motion-planner: 10 planner + 5 step generator tests
- thermal: 7 PID + 10 manager tests
- sdcard: 7 line reader tests
- dispatcher: 11 command routing tests
- gcode-parser: 13 existing parser tests

Requirements:
- Add MVP.md checklist with pressure advance, input shaping, CAN
  toolboard/CBOR, and 13 categories of functional requirements
- Update CLAUDE.md with architecture docs and workspace test command

https://claude.ai/code/session_01HW3tB5wfRQxiio5qmPbFmt
New board crates with complete pin mappings:
- board-ebb42: BTT EBB42 v1.2 CAN toolboard (STM32G0B1CBT6)
- board-pico: BTT SKR Pico v1.0 mainboard (RP2040)

New firmware binary crates:
- firmware-ebb42: CAN toolboard firmware (stepper + thermal + CAN tasks)
- firmware-pico: Full mainboard firmware (dispatcher + planner + thermal)

Each firmware is a thin wiring layer — all business logic stays in
portable library crates via printer-hal traits.

https://claude.ai/code/session_01HW3tB5wfRQxiio5qmPbFmt
@jvishnefske
jvishnefske merged commit 3443d0d into main Feb 19, 2026
4 checks passed
@jvishnefske
jvishnefske deleted the claude/duet3-async-actors-A0jGn branch February 19, 2026 07:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants